/*
ID: icerupt1
PROG: contact
LANG: C++11
*/

/* solution
 *
 *
 *
*/
#include <fstream>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>

std::ifstream fin {"contact.in" };
std::ofstream fout{"contact.out"};

int a, b, n;
std::string s;
std::map<std::string, int> count;
using data_type = std::pair<std::string, int>;
std::vector<data_type> print{{"!", 1<<24}};

int main()
{
	fin >> a >> b >> n;
	for (std::string tmp; fin >> tmp; ) s += tmp;

	int len = s.size(); s += '$';
	for (int i = 0; i < len; i++) {
		std::string cut = s.substr(i, a);
		for (int j = i + a; j <= std::min(i + b, len); cut += s[j++])
			count[cut]++;
	}

	for (auto i : count)
		print.push_back(i);

	std::sort(print.begin(), print.end(), [](data_type a, data_type b){
		return a.second > b.second || (a.second == b.second &&
				a.first.size() < b.first.size()) || (a.second == b.second
					&& a.first.size() == b.first.size() &&
						a.first < b.first);
	});

	int list = 0, perline = 0;
	for (int i = 1; i < (int)print.size(); i++) {
		if (print[i].second != print[i-1].second) {
			if (list >= n) break;
			if (list++) { std::cout << '\n'; fout << '\n'; }
			std::cout << print[i].second << '\n';
			fout << print[i].second << '\n';
			std::cout << print[i].first;
			fout << print[i].first;
			perline = 0;
		} else {
			if (!(perline % 6)) { std::cout << '\n'; fout << '\n'; }
			else				{ std::cout << ' '; fout << ' '; }
			std::cout << print[i].first;
			fout << print[i].first;
		}
		perline++;
	}
	std::cout << '\n';
	fout << '\n';
}
